home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / pdcurs21.zip / PRIVATE.ZIP / _SETCRSR.C < prev    next >
Text File  |  1992-11-21  |  2KB  |  79 lines

  1. #define        CURSES_LIBRARY  1
  2. #include <curses.h>
  3.  
  4. #ifndef        NDEBUG
  5. char *rcsid__setcrsr = "$Header: c:/curses/private/RCS/_setcrsr.c%v 2.0 1992/11/15 03:24:36 MH Rel $";
  6. #endif
  7.  
  8.  
  9.  
  10.  
  11. /*man-start*********************************************************************
  12.  
  13.   PDC_set_cursor_mode()        - Set the cursor start and stop scan lines.
  14.  
  15.   PDCurses Description:
  16.        Sets the cursor type to begin in scan line startrow and end in
  17.        scan line endrow.  Both values should be 0-31.
  18.  
  19.   PDCurses Return Value:
  20.        This function returns OK on success and ERR on error.
  21.  
  22.   PDCurses Errors:
  23.        No errors are defined for this function.
  24.  
  25.   Portability:
  26.        PDCurses        int PDC_set_cursor_mode( int startrow, int endrow );
  27.  
  28. **man-end**********************************************************************/
  29.  
  30. int    PDC_set_cursor_mode( int startrow, int endrow )
  31. {
  32. #ifdef FLEXOS
  33.        /*
  34.         * Under FLEXOS, this routine translates the input parameters in the
  35.         * following way:
  36.         *
  37.         * startrow --> visible_cursor endrow    -->    cursor type:
  38.         * underline = 0; block = 1;
  39.         *
  40.         * VCWM_CURSOR     0x0100          bit - 8 Cursor off VCWM_BLOCK        
  41.         * 0x0200          bit - 9 Block Cursor 
  42.         *
  43.         */
  44.        unsigned short mybuff = 0;
  45.  
  46.        retcode = s_getfield(T_VIRCON, VC_MODE, 1L, (void far *) &mybuff, 2L);
  47.        if (retcode < 0L)
  48.                return( ERR );
  49.        if (startrow)
  50.                mybuff &= ~VCWM_CURSOR;
  51.        else
  52.                mybuff |= VCWM_CURSOR;
  53.  
  54.        if (endrow)
  55.                mybuff |= VCWM_BLOCK;
  56.        else
  57.                mybuff &= ~VCWM_BLOCK;
  58.  
  59.        retcode = s_setfield(T_VIRCON, VC_MODE, 1L, (void far *) &mybuff, 2L);
  60.        return( (retcode < 0L) ? ERR : OK );
  61. #endif
  62. #ifdef DOS
  63.        regs.h.ah = 0x01;
  64.        regs.h.ch = (unsigned char) startrow;
  65.        regs.h.cl = (unsigned char) endrow;
  66.        int86(0x10, ®s, ®s);
  67.        return( OK );
  68. #endif
  69. #ifdef OS2
  70.        VIOCURSORINFO cursorInfo;
  71.  
  72.        cursorInfo.yStart = startrow;
  73.        cursorInfo.cEnd = endrow;
  74.        cursorInfo.cx = 1;
  75.        cursorInfo.attr = 0;
  76.        return (VioSetCurType (&cursorInfo, 0) == 0);
  77. #endif
  78. }
  79.